<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
{{if $type==0}}
<title>magento创建赞助订单</title>
{{/if}}
{{if $type==1}}
<title>magento编辑赞助订单</title>
{{/if}}
<script language="javascript">
function addattribute(ms_id)
{
    $("#ms_id").val(ms_id);
    $('#addattributeform').modal('show');   
}
</script>
<body class="withvernav">
<div class="bodywrapper">
 {{include file='/public/leftmenu.tpl'}}
    <div class="centercontent">
    
        <div class="pageheader notab">
        {{if $type==0}}
            <h1 class="pagetitle">magento创建赞助订单</h1>
        {{/if}}
        {{if $type==1}}
            <h1 class="pagetitle">magento编辑赞助订单</h1>
        {{/if}}
            <span class="pagedesc"></span>
            
        </div><!--pageheader-->

        <div id="contentwrapper" class="contentwrapper">
        	
        	<div id="basicform" class="subcontent">
           {{foreach from=$sponsorlist item=li key=key}}
					<form class="stdform stdform2" method="post" action="/management/doShopsAuth">
                    	<p>
                        	<label>类型 *</label>
                            <span class="field">    
                            <select name="ms_type" id="ms_type"  class="selection select2_group" style="width:400px;">
                            <option value="*" >选择赞助类型</option>
                            <option value="1" {{if 1==$li.ms_type}} selected{{/if}}>付费广告</option>
                            <option value="2" {{if 2==$li.ms_type}} selected{{/if}}>赞助衣服</option>
                            <option value="3" {{if 3==$li.ms_type}} selected{{/if}}>赠送礼物</option>
                            <option value="4" {{if 4==$li.ms_type}} selected{{/if}}>工作外包</option>
                            </select>
                            </span>
                        </p>
                        <p>
                            <label>目的 *</label>
                            <span class="field">
                            <select name="ms_purpose" id="ms_purpose"  class="selection select2_group" style="width:400px;">
                            <option value="*" >选择赞助目的</option>
                            <option value="1" {{if 1==$li.ms_purpose}} selected{{/if}}>文字连接</option>
                            <option value="2" {{if 2==$li.ms_purpose}} selected{{/if}}>banner广告</option>
                            <option value="3" {{if 3==$li.ms_purpose}} selected{{/if}}>博客网站宣传</option>
                            <option value="4" {{if 4==$li.ms_purpose}} selected{{/if}}>社交媒体宣传</option>
                            <option value="5" {{if 5==$li.ms_purpose}} selected{{/if}}>文章撰写</option>
                            <option value="6" {{if 6==$li.ms_purpose}} selected{{/if}}>模特返图</option>
                            </select>
                            </span>
                        </p>
                        <p>
                            <label>博客/网址： *</label>
                            <span class="field"><input type="text" name="ms_blog_url" id="ms_blog_url" value="{{$li.ms_blog_url}}" class="longinput" /></span>
                        </p>
                                                <p>
                            <label>网站PR： </label>
                            <span class="field"><input type="text" name="ms_website_pr" id="ms_website_pr" value="{{$li.ms_website_pr}}" class="longinput" /></span>
                        </p>
                                                <p>
                            <label>社交媒体地址： </label>
                            <span class="field"><input type="text" name="ms_social_media_url" id="ms_social_media_url" value="{{$li.ms_social_media_url}}" class="longinput" /></span>
                        </p>
                                                <p>
                            <label>粉丝数量： *</label>
                            <span class="field"><input type="text" name="ms_funs_number" id="ms_funs_number" value="{{$li.ms_funs_number}}" class="longinput" /></span>
                        </p>
                                                <p>
                            <label>商品和数量： *</label>
                            <span class="field"><input type="text" name="ms_product_info" id="ms_product_info" value="{{$li.ms_product_info}}" class="longinput" /></span>
                        </p>
                        <p>格式：“sku,数量”，如果是多个商品则格式是“sku,数量+sku,数量”以此类推，中间符号为英文符号</p>
                                                <p>
                            <label>客户地址： *</label>
                            <span class="field"><input type="text" name="ms_object_address" id="ms_object_address" value="{{$li.ms_object_address}}" class="longinput" /></span>
                        </p>
                                                                        <p>
                            <label>城市： </label>
                            <span class="field"><input type="text" name="ms_object_city" id="ms_object_city" value="{{$li.ms_object_city}}" class="longinput" /></span>
                        </p>
                                                                        <p>
                            <label>州： *</label>
                            <span class="field"><input type="text" name="ms_object_state" id="ms_object_state" value="{{$li.ms_object_state}}" class="longinput" /></span>
                        </p>
                                                                        <p>
                            <label>国家： *</label>
                            <span class="field"><input type="text" name="ms_object_country" id="ms_object_country" value="{{$li.ms_object_country}}" class="longinput" /></span>
                        </p>
                                                                        <p>
                            <label>邮编： </label>
                            <span class="field"><input type="text" name="ms_object_post_code" id="ms_object_post_code" value="{{$li.ms_object_post_code}}" class="longinput" /></span>
                        </p>
                                                                        <p>
                            <label>电话： *</label>
                            <span class="field"><input type="text" name="ms_object_tp" id="ms_object_tp" value="{{$li.ms_object_tp}}" class="longinput" /></span>
                        </p>
                                                                        <p>
                            <label>订单备注信息： </label>
                            <span class="field">
                           <textarea name="ms_object_remarks" id="ms_object_remarks" rows="4" cols="110" class="full_input" >{{$li.ms_object_remarks}}</textarea>
                            </span>
                        </p>
                                                                                                <p>
                            <label>姓名： </label>
                            <span class="field"><input type="text" name="ms_object_name" id="ms_object_name" value="{{$li.ms_object_name}}" class="longinput" /></span>
                        </p>
                                                                                                <p>
                            <label>邮箱： </label>
                            <span class="field"><input type="text" name="ms_object_email" id="ms_object_email" value="{{$li.ms_object_email}}" class="longinput" /></span>
                        </p>
                                                                                                <p>
                            <label>金额： </label>
                            <span class="field"><input type="text" name="ms_object_money" id="ms_object_money" value="{{$li.ms_object_money}}" class="longinput" /></span>
                        </p>
                                                                                                <p>
                            <label>币种： </label>
                            <span class="field">
                            <select name="ms_object_money_sign" id="ms_object_money_sign"  class="selection select2_group" style="width:400px;">
                            <option value="EUR" {{if EUR==$li.ms_object_money_sign}} selected{{/if}}>EUR</option>
                            <option value="GBP" {{if GBP==$li.ms_object_money_sign}} selected{{/if}}>GBP</option>
                            <option value="US" {{if US==$li.ms_object_money_sign}} selected{{/if}}>US</option>
                            <option value="AU" {{if AU==$li.ms_object_money_sign}} selected{{/if}}>AU</option>
                            <option value="USD" {{if USD==$li.ms_object_money_sign}} selected{{/if}}>USD</option>
                            <option value="AUD" {{if AUD==$li.ms_object_money_sign}} selected{{/if}}>AUD</option>
                            <option value="CAD" {{if CAD==$li.ms_object_money_sign}} selected{{/if}}>CAD</option>
                            <option value="JPY" {{if JPY==$li.ms_object_money_sign}} selected{{/if}}>JPY</option>
                            <option value="MYR" {{if MYR==$li.ms_object_money_sign}} selected{{/if}}>MYR</option>
                            <option value="SGD" {{if SGD==$li.ms_object_money_sign}} selected{{/if}}>SGD</option>
                            <option value="THD" {{if THD==$li.ms_object_money_sign}} selected{{/if}}>THD</option>
                            <option value="IDR" {{if IDR==$li.ms_object_money_sign}} selected{{/if}}>IDR</option>
                            <option value="PHP" {{if PHP==$li.ms_object_money_sign}} selected{{/if}}>PHP</option>
                            <option value="RMB" {{if PHP==$li.ms_object_money_sign}} selected{{/if}}>RMB</option>
                            </select>
                            </span>
                        </p>
                                                                                                <p>
                            <label>起始时间： </label>
                            <span class="field"><input type="text" name="ms_object_startime" id="ms_object_startime" value="{{$li.ms_object_startime}}" class="longinput" /></span>
                        </p>                                                                        <p>
                            <label>结束时间： </label>
                            <span class="field"><input type="text" name="ms_object_endtime" id="ms_object_endtime" value="{{$li.ms_object_endtime}}" class="longinput" /></span>
                        </p>
                                                                                                <p>
                            <label>备注： </label>
                            <span class="field">
                            <textarea name="ms_remarks" id="ms_remarks" rows="4" cols="110" class="full_input" >{{$li.ms_remarks}}</textarea>
                            </span>
                        </p>
                        <label>来源/媒介： </label>
                            <span class="field"><input type="text" name="ms_source" id="ms_source" value="{{$li.ms_source}}" class="longinput" /></span>
                        </p>
                        <p>
                        <label>交易次数： </label>
                            <span class="field"><input type="text" name="ms_number_transactions" id="ms_number_transactions" value="{{$li.ms_number_transactions}}" class="longinput" /></span>
                        </p>
                        <p>
                        <label>{{$li.ms_income_currency}}收入： </label>
                            <span class="field"><input type="text" name="ms_income" id="ms_income" value="{{$li.ms_income}}" class="longinput" /></span>
                        </p>
                        <p>
                        <label>人民币收入： </label>
                            <span class="field"><input type="text" name="ms_rmb_income" id="ms_rmb_income" value="{{$li.ms_rmb_income}}" class="longinput" /></span>
                        </p>

                        <p class="stdformbutton">
                        {{if $type==0}}
                        	<button type="button" class="submit radius2" onClick="saveform({{$type}})">Submit Button</button>&nbsp;&nbsp;&nbsp;
                        {{/if}}
                        {{if $nowuserid==277 && $li.ms_status==1}}
                       <button type="button" class="submit radius2" onClick="examination({{$li.ms_id}},{{$li.ms_type}})">审核通过</button>&nbsp;&nbsp;&nbsp;
                        {{/if}}
                        {{if $nowuserid==79 && $li.ms_status==1}}
                       <button type="button" class="submit radius2" onClick="examination({{$li.ms_id}},{{$li.ms_type}})">审核通过</button>&nbsp;&nbsp;&nbsp;
                        {{/if}}
                        {{if $nowuserid==350 && $li.ms_status==1}}
                       <button type="button" class="submit radius2" onClick="examination({{$li.ms_id}},{{$li.ms_type}})">审核通过</button>&nbsp;&nbsp;&nbsp;
                        {{/if}}
                        {{if $nowuserid==260 && $li.ms_status==1}}
                        <button type="button" class="submit radius2" onClick="examination({{$li.ms_id}},{{$li.ms_type}})">审核通过</button>&nbsp;&nbsp;&nbsp;
                        {{/if}}
                        </p>
                        <p>
                        <button type="button" class="submit radius2" onClick="saveform({{$type}},{{$li.ms_id}})">Submit Button</button>&nbsp;&nbsp;&nbsp;
                         {{if $type==1}}
                            

        <table cellpadding="0" cellspacing="0" border="0" class="stdtable">
            <thead>
              <tr>
                <th class="head1">
                 <label>返图图片: </label>
                 <span class="field">
                {{foreach from=$sponsorimg item=imgli key=imgkey}}
                    <div style="display: inline-block;">
                    <a href="../{{$imgli.2}}" target="_blank"><img style="width: 100px;height: 100px;" src="{{$imgli.3}}"></a><br/>
                    <a href="javascript:void(0)" onClick="deleteimg({{$imgkey}},{{$li.ms_id}})" class="btn btn_orange btn_flag">
                    <span>删除</span>
                    </a>
                    </div>
                {{/foreach}} 
                </span>
                <a href="javascript:void(0)" onClick="addattribute({{$li.ms_id}})" class="btn btn_orange btn_flag">
                <span>上传图片</span>
                </a></th>
                
              </tr>
            </thead>
          </table>

                        {{/if}}
                        </p>


                    </form>
			{{/foreach}}		
                    <br />

            </div><!--subcontent-->
            
        
        </div><!--contentwrapper-->
        
	</div><!-- centercontent -->
    
    
</div><!--bodywrapper-->





<!-- 模态框（Modal）添加商品图片 -->
<form action="/magento/ajaxbutton?op=upimages" enctype="multipart/form-data"  method="post" name="otherform" id="otherform" >
<input type="hidden" name="ms_id" id="ms_id">
  <div class="modal fade" id="addattributeform" tabindex="-1" role="dialog" aria-labelledby="returnaddattributeform" aria-hidden="true">
    <div class="modal-dialog" style="width:740px;">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" 
               aria-hidden="true">× </button>
          <h4 class="modal-title" id="returnaddattributeform"> 上传图片(图片格式只允许 JPG GIF和PNG) </h4>
        </div>
        <div class="modal-body">
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td>上传： </td>
              <td align="left"><input type="file" name="userfile[1]" id="userfile1" /> <a href="javascript:void(0)"  onClick="showinput('fileinput')" class="btn btn_book"><span>添加一张图片</span></a></td>
            </tr>
            <tbody id="fileinput"></tbody>
          
          </table>
          <div class="modal-footer">
            <button type="button" class="btn btn-default" 
               data-dismiss="modal"> 关闭 </button>
            <button type="submit" class="submit radius2" > 提交 </button>
          </div>
        </div>
        <!-- /.modal-content --> 
      </div>
      <!-- /.modal-dialog --> 
    </div>
  </div>
</form>
<!-- 模态框（Modal）添加商品图片 -->











</body>
<script language="javascript">
function saveform(type,id)
{
//验证
    if($("#ms_object_address").val()=="")
    {
        alert("客户地址不能为空！");
        return false;   
    }

        if($("#ms_object_country").val()=="")
    {
        alert("国家不能为空！");
        return false;   
    }
        if($("#ms_object_post_code").val()=="")
    {
        alert("邮编不能为空！");
        return false;   
    }
        if($("#ms_object_name").val()=="")
    {
        alert("姓名不能为空！");
        return false;   
    }
        if($("#ms_object_money").val()=="")
    {
        alert("金额不能为空！");
        return false;   
    }

	$.post("/magento/ajaxbutton", {"op": "savesponsor","type":type,"id":id,"ms_type":$("#ms_type").val(),"ms_purpose":$("#ms_purpose").val(),"ms_blog_url":$("#ms_blog_url").val(),"ms_website_pr":$("#ms_website_pr").val(),"ms_social_media_url":$("#ms_social_media_url").val(),"ms_funs_number":$("#ms_funs_number").val(),"ms_activity_address":$("#ms_activity_address").val(),"ms_product_info":$("#ms_product_info").val(),"ms_object_address":$("#ms_object_address").val(),"ms_object_city":$("#ms_object_city").val(),"ms_object_state":$("#ms_object_state").val(),"ms_object_country":$("#ms_object_country").val(),"ms_object_post_code":$("#ms_object_post_code").val(),"ms_object_tp":$("#ms_object_tp").val(),"ms_object_remarks":$("#ms_object_remarks").val(),"ms_object_name":$("#ms_object_name").val(),"ms_object_email":$("#ms_object_email").val(),"ms_object_money":$("#ms_object_money").val(),"ms_object_money_sign":$("#ms_object_money_sign").val(),"ms_object_startime":$("#ms_object_startime").val(),"ms_object_endtime":$("#ms_object_endtime").val(),"ms_remarks":$("#ms_remarks").val(),"ms_source":$("#ms_source").val(),"ms_number_transactions":$("#ms_number_transactions").val(),"ms_income":$("#ms_income").val(),"ms_rmb_income":$('#ms_rmb_income').val()},
		function(data){
            document.location.href = data;
		}); 
}

function examination(id,type){
    $.post("/magento/ajaxbutton",{"op": "examination","id":id,"type":type},
        function(data){
            document.location.href = data;
        }
        );
}

function deleteimg(key,id){
    $.post("/magento/ajaxbutton",{"op":"deleteimg","id":id,"key":key},
        function(data){
            document.location.href = data;
            // alert(data);
        });
}
</script>
</html>
